using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BHXH.Core.Domain;
using BHXH.Core.IService;
using FX.Data;
using NHibernate;
using NHibernate.Cfg;
using System.Reflection;

namespace BHXH.Core.ServiceImp
{
    public class quanhuyenService: BaseService<quanhuyen ,int>,IquanhuyenService
    {
        static ISession mySession;
        public quanhuyenService(string sessionFactoryConfigPath)
            : base(sessionFactoryConfigPath)
        {}
        public IList<quanhuyen> layTatCaQuanHuyen()
        {
            var a = GetAll();
            return a;
        }

        public IList<quanhuyen> GetQuanHuyenByID(int Mathanhpho)
        {
            using (mySession = this.NHibernateSession.SessionFactory.OpenSession())
            {
                IList<quanhuyen> query = mySession.CreateQuery("FROM quanhuyen q where q.ThanhPhoId = :m")
                    .SetParameter("m", Mathanhpho)
                    .List<quanhuyen>();
                return query.ToList();
            }
        }
    }

}